<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - mbi.info - /usr/include/c++/4.4.1/bits/stl_pair.h</title>
  <link rel="stylesheet" type="text/css" href="../../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../../../../../index.html">directory</a> - <a href="index.html">usr/include/c++/4.4.1/bits</a> - stl_pair.h</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>mbi.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2010-01-23</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">7</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">42.9 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">3</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : // Pair implementation -*- C++ -*-
<span class="lineNum">       2 </span>                : 
<span class="lineNum">       3 </span>                : // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
<span class="lineNum">       4 </span>                : // Free Software Foundation, Inc.
<span class="lineNum">       5 </span>                : //
<span class="lineNum">       6 </span>                : // This file is part of the GNU ISO C++ Library.  This library is free
<span class="lineNum">       7 </span>                : // software; you can redistribute it and/or modify it under the
<span class="lineNum">       8 </span>                : // terms of the GNU General Public License as published by the
<span class="lineNum">       9 </span>                : // Free Software Foundation; either version 3, or (at your option)
<span class="lineNum">      10 </span>                : // any later version.
<span class="lineNum">      11 </span>                : 
<span class="lineNum">      12 </span>                : // This library is distributed in the hope that it will be useful,
<span class="lineNum">      13 </span>                : // but WITHOUT ANY WARRANTY; without even the implied warranty of
<span class="lineNum">      14 </span>                : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
<span class="lineNum">      15 </span>                : // GNU General Public License for more details.
<span class="lineNum">      16 </span>                : 
<span class="lineNum">      17 </span>                : // Under Section 7 of GPL version 3, you are granted additional
<span class="lineNum">      18 </span>                : // permissions described in the GCC Runtime Library Exception, version
<span class="lineNum">      19 </span>                : // 3.1, as published by the Free Software Foundation.
<span class="lineNum">      20 </span>                : 
<span class="lineNum">      21 </span>                : // You should have received a copy of the GNU General Public License and
<span class="lineNum">      22 </span>                : // a copy of the GCC Runtime Library Exception along with this program;
<span class="lineNum">      23 </span>                : // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
<span class="lineNum">      24 </span>                : // &lt;http://www.gnu.org/licenses/&gt;.
<span class="lineNum">      25 </span>                : 
<span class="lineNum">      26 </span>                : /*
<span class="lineNum">      27 </span>                :  *
<span class="lineNum">      28 </span>                :  * Copyright (c) 1994
<span class="lineNum">      29 </span>                :  * Hewlett-Packard Company
<span class="lineNum">      30 </span>                :  *
<span class="lineNum">      31 </span>                :  * Permission to use, copy, modify, distribute and sell this software
<span class="lineNum">      32 </span>                :  * and its documentation for any purpose is hereby granted without fee,
<span class="lineNum">      33 </span>                :  * provided that the above copyright notice appear in all copies and
<span class="lineNum">      34 </span>                :  * that both that copyright notice and this permission notice appear
<span class="lineNum">      35 </span>                :  * in supporting documentation.  Hewlett-Packard Company makes no
<span class="lineNum">      36 </span>                :  * representations about the suitability of this software for any
<span class="lineNum">      37 </span>                :  * purpose.  It is provided &quot;as is&quot; without express or implied warranty.
<span class="lineNum">      38 </span>                :  *
<span class="lineNum">      39 </span>                :  *
<span class="lineNum">      40 </span>                :  * Copyright (c) 1996,1997
<span class="lineNum">      41 </span>                :  * Silicon Graphics Computer Systems, Inc.
<span class="lineNum">      42 </span>                :  *
<span class="lineNum">      43 </span>                :  * Permission to use, copy, modify, distribute and sell this software
<span class="lineNum">      44 </span>                :  * and its documentation for any purpose is hereby granted without fee,
<span class="lineNum">      45 </span>                :  * provided that the above copyright notice appear in all copies and
<span class="lineNum">      46 </span>                :  * that both that copyright notice and this permission notice appear
<span class="lineNum">      47 </span>                :  * in supporting documentation.  Silicon Graphics makes no
<span class="lineNum">      48 </span>                :  * representations about the suitability of this software for any
<span class="lineNum">      49 </span>                :  * purpose.  It is provided &quot;as is&quot; without express or implied warranty.
<span class="lineNum">      50 </span>                :  */
<span class="lineNum">      51 </span>                : 
<span class="lineNum">      52 </span>                : /** @file stl_pair.h
<span class="lineNum">      53 </span>                :  *  This is an internal header file, included by other library headers.
<span class="lineNum">      54 </span>                :  *  You should not attempt to use it directly.
<span class="lineNum">      55 </span>                :  */
<span class="lineNum">      56 </span>                : 
<span class="lineNum">      57 </span>                : #ifndef _STL_PAIR_H
<span class="lineNum">      58 </span>                : #define _STL_PAIR_H 1
<span class="lineNum">      59 </span>                : 
<span class="lineNum">      60 </span>                : #include &lt;bits/move.h&gt; // for std::move / std::forward, std::decay, and
<span class="lineNum">      61 </span>                :                        // std::swap
<span class="lineNum">      62 </span>                : 
<span class="lineNum">      63 </span>                : _GLIBCXX_BEGIN_NAMESPACE(std)
<span class="lineNum">      64 </span>                : 
<span class="lineNum">      65 </span>                :   /// pair holds two objects of arbitrary type.
<span class="lineNum">      66 </span>                :   template&lt;class _T1, class _T2&gt;
<span class="lineNum">      67 </span>                :     struct pair
<span class="lineNum">      68 </span><span class="lineCov">            292 :     {</span>
<span class="lineNum">      69 </span>                :       typedef _T1 first_type;    ///&lt;  @c first_type is the first bound type
<span class="lineNum">      70 </span>                :       typedef _T2 second_type;   ///&lt;  @c second_type is the second bound type
<span class="lineNum">      71 </span>                : 
<span class="lineNum">      72 </span>                :       _T1 first;                 ///&lt; @c first is a copy of the first object
<span class="lineNum">      73 </span>                :       _T2 second;                ///&lt; @c second is a copy of the second object
<span class="lineNum">      74 </span>                : 
<span class="lineNum">      75 </span>                :       // _GLIBCXX_RESOLVE_LIB_DEFECTS
<span class="lineNum">      76 </span>                :       // 265.  std::pair::pair() effects overly restrictive
<span class="lineNum">      77 </span>                :       /** The default constructor creates @c first and @c second using their
<span class="lineNum">      78 </span>                :        *  respective default constructors.  */
<span class="lineNum">      79 </span>                :       pair()
<span class="lineNum">      80 </span>                :       : first(), second() { }
<span class="lineNum">      81 </span>                : 
<span class="lineNum">      82 </span>                :       /** Two objects may be passed to a @c pair constructor to be copied.  */
<span class="lineNum">      83 </span><span class="lineCov">            169 :       pair(const _T1&amp; __a, const _T2&amp; __b)</span>
<span class="lineNum">      84 </span><span class="lineCov">            169 :       : first(__a), second(__b) { }</span>
<span class="lineNum">      85 </span>                : 
<span class="lineNum">      86 </span>                : #ifdef __GXX_EXPERIMENTAL_CXX0X__
<span class="lineNum">      87 </span>                :       template&lt;class _U1, class _U2&gt;
<span class="lineNum">      88 </span>                :         pair(_U1&amp;&amp; __x, _U2&amp;&amp; __y)
<span class="lineNum">      89 </span>                :         : first(std::forward&lt;_U1&gt;(__x)),
<span class="lineNum">      90 </span>                :           second(std::forward&lt;_U2&gt;(__y)) { }
<span class="lineNum">      91 </span>                : 
<span class="lineNum">      92 </span>                :       pair(pair&amp;&amp; __p)
<span class="lineNum">      93 </span>                :       : first(std::move(__p.first)),
<span class="lineNum">      94 </span>                :         second(std::move(__p.second)) { }
<span class="lineNum">      95 </span>                : #endif
<span class="lineNum">      96 </span>                : 
<span class="lineNum">      97 </span>                :       /** There is also a templated copy ctor for the @c pair class itself.  */
<span class="lineNum">      98 </span>                :       template&lt;class _U1, class _U2&gt;
<span class="lineNum">      99 </span><span class="lineNoCov">              0 :         pair(const pair&lt;_U1, _U2&gt;&amp; __p)</span>
<span class="lineNum">     100 </span>                :         : first(__p.first),
<span class="lineNum">     101 </span><span class="lineNoCov">              0 :           second(__p.second) { }</span>
<span class="lineNum">     102 </span>                : 
<span class="lineNum">     103 </span>                : #ifdef __GXX_EXPERIMENTAL_CXX0X__
<span class="lineNum">     104 </span>                :       template&lt;class _U1, class _U2&gt;
<span class="lineNum">     105 </span>                :         pair(pair&lt;_U1, _U2&gt;&amp;&amp; __p)
<span class="lineNum">     106 </span>                :         : first(std::move(__p.first)),
<span class="lineNum">     107 </span>                :           second(std::move(__p.second)) { }
<span class="lineNum">     108 </span>                : 
<span class="lineNum">     109 </span>                :       // http://gcc.gnu.org/ml/libstdc++/2007-08/msg00052.html
<span class="lineNum">     110 </span>                :       template&lt;class _U1, class _Arg0, class... _Args&gt;
<span class="lineNum">     111 </span>                :         pair(_U1&amp;&amp; __x, _Arg0&amp;&amp; __arg0, _Args&amp;&amp;... __args)
<span class="lineNum">     112 </span>                :         : first(std::forward&lt;_U1&gt;(__x)),
<span class="lineNum">     113 </span>                :           second(std::forward&lt;_Arg0&gt;(__arg0),
<span class="lineNum">     114 </span>                :                  std::forward&lt;_Args&gt;(__args)...) { }
<span class="lineNum">     115 </span>                : 
<span class="lineNum">     116 </span>                :       pair&amp;
<span class="lineNum">     117 </span>                :       operator=(pair&amp;&amp; __p)
<span class="lineNum">     118 </span>                :       { 
<span class="lineNum">     119 </span>                :         first = std::move(__p.first);
<span class="lineNum">     120 </span>                :         second = std::move(__p.second);
<span class="lineNum">     121 </span>                :         return *this;
<span class="lineNum">     122 </span>                :       }
<span class="lineNum">     123 </span>                : 
<span class="lineNum">     124 </span>                :       template&lt;class _U1, class _U2&gt;
<span class="lineNum">     125 </span>                :         pair&amp;
<span class="lineNum">     126 </span>                :         operator=(pair&lt;_U1, _U2&gt;&amp;&amp; __p)
<span class="lineNum">     127 </span>                :         {
<span class="lineNum">     128 </span>                :           first = std::move(__p.first);
<span class="lineNum">     129 </span>                :           second = std::move(__p.second);
<span class="lineNum">     130 </span>                :           return *this;
<span class="lineNum">     131 </span>                :         }
<span class="lineNum">     132 </span>                : 
<span class="lineNum">     133 </span>                :       void
<span class="lineNum">     134 </span>                :       swap(pair&amp;&amp; __p)
<span class="lineNum">     135 </span>                :       {
<span class="lineNum">     136 </span>                :         using std::swap;
<span class="lineNum">     137 </span>                :         swap(first, __p.first);
<span class="lineNum">     138 </span>                :         swap(second, __p.second);       
<span class="lineNum">     139 </span>                :       }
<span class="lineNum">     140 </span>                : #endif
<span class="lineNum">     141 </span>                :     };
<span class="lineNum">     142 </span>                : 
<span class="lineNum">     143 </span>                :   /// Two pairs of the same type are equal iff their members are equal.
<span class="lineNum">     144 </span>                :   template&lt;class _T1, class _T2&gt;
<span class="lineNum">     145 </span>                :     inline bool
<span class="lineNum">     146 </span>                :     operator==(const pair&lt;_T1, _T2&gt;&amp; __x, const pair&lt;_T1, _T2&gt;&amp; __y)
<span class="lineNum">     147 </span>                :     { return __x.first == __y.first &amp;&amp; __x.second == __y.second; }
<span class="lineNum">     148 </span>                : 
<span class="lineNum">     149 </span>                :   /// &lt;http://gcc.gnu.org/onlinedocs/libstdc++/manual/utilities.html&gt;
<span class="lineNum">     150 </span>                :   template&lt;class _T1, class _T2&gt;
<span class="lineNum">     151 </span>                :     inline bool
<span class="lineNum">     152 </span>                :     operator&lt;(const pair&lt;_T1, _T2&gt;&amp; __x, const pair&lt;_T1, _T2&gt;&amp; __y)
<span class="lineNum">     153 </span>                :     { return __x.first &lt; __y.first
<span class="lineNum">     154 </span>                :              || (!(__y.first &lt; __x.first) &amp;&amp; __x.second &lt; __y.second); }
<span class="lineNum">     155 </span>                : 
<span class="lineNum">     156 </span>                :   /// Uses @c operator== to find the result.
<span class="lineNum">     157 </span>                :   template&lt;class _T1, class _T2&gt;
<span class="lineNum">     158 </span>                :     inline bool
<span class="lineNum">     159 </span>                :     operator!=(const pair&lt;_T1, _T2&gt;&amp; __x, const pair&lt;_T1, _T2&gt;&amp; __y)
<span class="lineNum">     160 </span>                :     { return !(__x == __y); }
<span class="lineNum">     161 </span>                : 
<span class="lineNum">     162 </span>                :   /// Uses @c operator&lt; to find the result.
<span class="lineNum">     163 </span>                :   template&lt;class _T1, class _T2&gt;
<span class="lineNum">     164 </span>                :     inline bool
<span class="lineNum">     165 </span>                :     operator&gt;(const pair&lt;_T1, _T2&gt;&amp; __x, const pair&lt;_T1, _T2&gt;&amp; __y)
<span class="lineNum">     166 </span>                :     { return __y &lt; __x; }
<span class="lineNum">     167 </span>                : 
<span class="lineNum">     168 </span>                :   /// Uses @c operator&lt; to find the result.
<span class="lineNum">     169 </span>                :   template&lt;class _T1, class _T2&gt;
<span class="lineNum">     170 </span>                :     inline bool
<span class="lineNum">     171 </span>                :     operator&lt;=(const pair&lt;_T1, _T2&gt;&amp; __x, const pair&lt;_T1, _T2&gt;&amp; __y)
<span class="lineNum">     172 </span>                :     { return !(__y &lt; __x); }
<span class="lineNum">     173 </span>                : 
<span class="lineNum">     174 </span>                :   /// Uses @c operator&lt; to find the result.
<span class="lineNum">     175 </span>                :   template&lt;class _T1, class _T2&gt;
<span class="lineNum">     176 </span>                :     inline bool
<span class="lineNum">     177 </span>                :     operator&gt;=(const pair&lt;_T1, _T2&gt;&amp; __x, const pair&lt;_T1, _T2&gt;&amp; __y)
<span class="lineNum">     178 </span>                :     { return !(__x &lt; __y); }
<span class="lineNum">     179 </span>                : 
<span class="lineNum">     180 </span>                : #ifdef __GXX_EXPERIMENTAL_CXX0X__
<span class="lineNum">     181 </span>                :   /// See std::pair::swap().
<span class="lineNum">     182 </span>                :   // Note:  no std::swap overloads in C++03 mode, this has performance
<span class="lineNum">     183 </span>                :   //        implications, see, eg, libstdc++/38466.
<span class="lineNum">     184 </span>                :   template&lt;class _T1, class _T2&gt;
<span class="lineNum">     185 </span>                :     inline void
<span class="lineNum">     186 </span>                :     swap(pair&lt;_T1, _T2&gt;&amp; __x, pair&lt;_T1, _T2&gt;&amp; __y)
<span class="lineNum">     187 </span>                :     { __x.swap(__y); }
<span class="lineNum">     188 </span>                : 
<span class="lineNum">     189 </span>                :   template&lt;class _T1, class _T2&gt;
<span class="lineNum">     190 </span>                :     inline void
<span class="lineNum">     191 </span>                :     swap(pair&lt;_T1, _T2&gt;&amp;&amp; __x, pair&lt;_T1, _T2&gt;&amp; __y)
<span class="lineNum">     192 </span>                :     { __x.swap(__y); }
<span class="lineNum">     193 </span>                : 
<span class="lineNum">     194 </span>                :   template&lt;class _T1, class _T2&gt;
<span class="lineNum">     195 </span>                :     inline void
<span class="lineNum">     196 </span>                :     swap(pair&lt;_T1, _T2&gt;&amp; __x, pair&lt;_T1, _T2&gt;&amp;&amp; __y)
<span class="lineNum">     197 </span>                :     { __x.swap(__y); }
<span class="lineNum">     198 </span>                : #endif
<span class="lineNum">     199 </span>                : 
<span class="lineNum">     200 </span>                :   /**
<span class="lineNum">     201 </span>                :    *  @brief A convenience wrapper for creating a pair from two objects.
<span class="lineNum">     202 </span>                :    *  @param  x  The first object.
<span class="lineNum">     203 </span>                :    *  @param  y  The second object.
<span class="lineNum">     204 </span>                :    *  @return   A newly-constructed pair&lt;&gt; object of the appropriate type.
<span class="lineNum">     205 </span>                :    *
<span class="lineNum">     206 </span>                :    *  The standard requires that the objects be passed by reference-to-const,
<span class="lineNum">     207 </span>                :    *  but LWG issue #181 says they should be passed by const value.  We follow
<span class="lineNum">     208 </span>                :    *  the LWG by default.
<span class="lineNum">     209 </span>                :    */
<span class="lineNum">     210 </span>                :   // _GLIBCXX_RESOLVE_LIB_DEFECTS
<span class="lineNum">     211 </span>                :   // 181.  make_pair() unintended behavior
<span class="lineNum">     212 </span>                : #ifndef __GXX_EXPERIMENTAL_CXX0X__
<span class="lineNum">     213 </span>                :   template&lt;class _T1, class _T2&gt;
<span class="lineNum">     214 </span>                :     inline pair&lt;_T1, _T2&gt;
<span class="lineNum">     215 </span><span class="lineNoCov">              0 :     make_pair(_T1 __x, _T2 __y)</span>
<span class="lineNum">     216 </span><span class="lineNoCov">              0 :     { return pair&lt;_T1, _T2&gt;(__x, __y); }</span>
<span class="lineNum">     217 </span>                : #else
<span class="lineNum">     218 </span>                :   template&lt;typename _Tp&gt;
<span class="lineNum">     219 </span>                :     class reference_wrapper;
<span class="lineNum">     220 </span>                : 
<span class="lineNum">     221 </span>                :   // Helper which adds a reference to a type when given a reference_wrapper
<span class="lineNum">     222 </span>                :   template&lt;typename _Tp&gt;
<span class="lineNum">     223 </span>                :     struct __strip_reference_wrapper
<span class="lineNum">     224 </span>                :     {
<span class="lineNum">     225 </span>                :       typedef _Tp __type;
<span class="lineNum">     226 </span>                :     };
<span class="lineNum">     227 </span>                : 
<span class="lineNum">     228 </span>                :   template&lt;typename _Tp&gt;
<span class="lineNum">     229 </span>                :     struct __strip_reference_wrapper&lt;reference_wrapper&lt;_Tp&gt; &gt;
<span class="lineNum">     230 </span>                :     {
<span class="lineNum">     231 </span>                :       typedef _Tp&amp; __type;
<span class="lineNum">     232 </span>                :     };
<span class="lineNum">     233 </span>                : 
<span class="lineNum">     234 </span>                :   template&lt;typename _Tp&gt;
<span class="lineNum">     235 </span>                :     struct __strip_reference_wrapper&lt;const reference_wrapper&lt;_Tp&gt; &gt;
<span class="lineNum">     236 </span>                :     {
<span class="lineNum">     237 </span>                :       typedef _Tp&amp; __type;
<span class="lineNum">     238 </span>                :     };
<span class="lineNum">     239 </span>                : 
<span class="lineNum">     240 </span>                :   template&lt;typename _Tp&gt;
<span class="lineNum">     241 </span>                :     struct __decay_and_strip
<span class="lineNum">     242 </span>                :     {
<span class="lineNum">     243 </span>                :       typedef typename __strip_reference_wrapper&lt;
<span class="lineNum">     244 </span>                :         typename decay&lt;_Tp&gt;::type&gt;::__type __type;
<span class="lineNum">     245 </span>                :     };
<span class="lineNum">     246 </span>                : 
<span class="lineNum">     247 </span>                :   // NB: DR 706.
<span class="lineNum">     248 </span>                :   template&lt;class _T1, class _T2&gt;
<span class="lineNum">     249 </span>                :     inline pair&lt;typename __decay_and_strip&lt;_T1&gt;::__type,
<span class="lineNum">     250 </span>                :                 typename __decay_and_strip&lt;_T2&gt;::__type&gt;
<span class="lineNum">     251 </span>                :     make_pair(_T1&amp;&amp; __x, _T2&amp;&amp; __y)
<span class="lineNum">     252 </span>                :     {
<span class="lineNum">     253 </span>                :       return pair&lt;typename __decay_and_strip&lt;_T1&gt;::__type,
<span class="lineNum">     254 </span>                :                   typename __decay_and_strip&lt;_T2&gt;::__type&gt;
<span class="lineNum">     255 </span>                :         (std::forward&lt;_T1&gt;(__x), std::forward&lt;_T2&gt;(__y));
<span class="lineNum">     256 </span>                :     }
<span class="lineNum">     257 </span>                : #endif
<span class="lineNum">     258 </span>                : 
<span class="lineNum">     259 </span>                : _GLIBCXX_END_NAMESPACE
<span class="lineNum">     260 </span>                : 
<span class="lineNum">     261 </span>                : #endif /* _STL_PAIR_H */
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
